.TH std::ranges::borrowed_iterator_t,std::ranges::borrowed_subrange_t 3 "2024.06.10" "http://cppreference.com" "C++ Standard Libary"
.SH NAME
std::ranges::borrowed_iterator_t,std::ranges::borrowed_subrange_t \- std::ranges::borrowed_iterator_t,std::ranges::borrowed_subrange_t

.SH Synopsis
   Defined in header <ranges>
   template< ranges::range R >                  \fB(1)\fP \fI(since C++20)\fP
   using borrowed_iterator_t = /* see below */;
   template< ranges::range R >                  \fB(2)\fP \fI(since C++20)\fP
   using borrowed_subrange_t = /* see below */;

   1) std::ranges::iterator_t<R> if R models borrowed_range, std::ranges::dangling
   otherwise.
   2) std::ranges::subrange<std::ranges::iterator_t<R>> if R models borrowed_range,
   std::ranges::dangling otherwise.

   These two alias templates are used by some constrained algorithms to avoid returning
   potentially dangling iterators or views.

.SH Possible implementation

.SH First version
   template< std::ranges::range R >
   using borrowed_iterator_t = std::conditional_t<std::ranges::borrowed_range<R>,
       std::ranges::iterator_t<R>, std::ranges::dangling>;
.SH Second version
   template< std::ranges::range R >
   using borrowed_subrange_t = std::conditional_t<std::ranges::borrowed_range<R>,
       std::ranges::subrange<std::ranges::iterator_t<R>>, std::ranges::dangling>;

.SH See also

   ranges::dangling a placeholder type indicating that an iterator or a subrange should
   (C++20)          not be returned since it would be dangling
                    \fI(class)\fP
